<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>走失宠物搜救系统后台</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/amazeui.min.css" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/admin.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/app.css">
	
<style type="text/css">
html{
	overflow:hidden;
}
</style>
</head>
<body>
<body>
	<header class="am-topbar am-topbar-inverse admin-header">
	<div class="am-topbar-brand">
		<a href="javascript:;" style="color: #14B4D0; padding-left: 15px">宠物搜救后台管理系统</a>
	</div>
	<div class="am-collapse am-topbar-collapse" id="topbar-collapse">
		<ul
			class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
			<li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
				<a class="am-dropdown-toggle tpl-header-list-link"
				href="javascript:;"> <span class="am-icon-bell-o"></span> 提醒 <span
					class="am-badge tpl-badge-success am-round"></span></span>
			</a>
				<ul class="am-dropdown-content tpl-dropdown-content">
					<li class="tpl-dropdown-content-external">
						<h3>
							你有 <span class="tpl-color-success"></span> 条提醒
						</h3>
					</li>
				</ul>
			</li>
			<li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
				<a class="am-dropdown-toggle tpl-header-list-link"
				href="javascript:;"> <span class="tpl-header-list-user-nick"><shiro:principal/></span>
			</a>
				<ul class="am-dropdown-content">
					<li><a href="#"><span class="am-icon-bell-o"></span> 资料</a></li>
					<li><a href="${pageContext.request.contextPath}/account/logout.do"><span class="am-icon-power-off"></span> 退出</a></li>
				</ul>
			</li>
		</ul>
	</div>
	</header>

	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="tpl-left-nav tpl-left-nav-hover">
			<div class="tpl-left-nav-title"></div>
			<div class="tpl-left-nav-list">
				<ul class="tpl-left-nav-menu">
					<li class="tpl-left-nav-item"><a
						href="${pageContext.request.contextPath}/admin/statistics.jsp"
						class="nav-link active" target="frame"> <i
							class="am-icon-home"></i> <span>首页</span>
					</a></li>
			   <shiro:hasRole name="admin">	
					<li class="tpl-left-nav-item"><a
						href="${pageContext.request.contextPath}/admin/newEvent.do"
						class="nav-link tpl-left-nav-link-list" target="frame"> <i
							class="am-icon-briefcase"></i> <span>事件受理</span> <i
							class="tpl-left-nav-content tpl-badge-danger"></i>
					</a></li>
               </shiro:hasRole>
					<li class="tpl-left-nav-item"><a
						href="${pageContext.request.contextPath}/my/police/policeEvent.do"
						class="nav-link tpl-left-nav-link-list" target="frame"> <i
							class="am-icon-edit"></i> <span>事件管理</span> <i
							class="tpl-left-nav-content tpl-badge-danger"></i>
					</a></li>
			   <shiro:hasRole name="admin">
					<li class="tpl-left-nav-item"><a
						href="${pageContext.request.contextPath}/admin/accountManager.do"
						class="nav-link tpl-left-nav-link-list" target="frame"> <i
							class="am-icon-user"></i> <span>&nbsp;用户管理</span> <i
							class="tpl-left-nav-content tpl-badge-danger"></i>
					</a></li>
					<li class="tpl-left-nav-item"><a
						href="${pageContext.request.contextPath}/admin/childrenManager.do"
						class="nav-link tpl-left-nav-link-list" target="frame"> <i
							class="am-icon-child"></i> <span>&nbsp;宠物管理</span> <i
							class="tpl-left-nav-content tpl-badge-danger"></i>
					</a></li>
					<li class="tpl-left-nav-item"><a
						href="${pageContext.request.contextPath}/admin/authorityManager.do"
						class="nav-link tpl-left-nav-link-list" target="frame"> <i
							class="am-icon-key"></i> <span>权限设置</span> <i
							class="tpl-left-nav-content tpl-badge-danger"></i>
					</a></li>
				</shiro:hasRole>
				</ul>
			</div>
		</div>
		<!--右侧内容开始-->
		<div class="tpl-content-wrapper">
			<iframe src="${pageContext.request.contextPath}/admin/statistics.jsp"
				id="mainFrame" name="frame" height="650" width="100%" scrolling="auto" frameborder="no" border="0" framespacing="0"></iframe>
		</div>
	</div>
	<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/amazeui.min.js"></script>
	<script type="text/javascript">
	$(document).ready(function() {
		$(".tpl-left-nav-item a").click(function(){
			$(".tpl-left-nav-item a").removeClass("active");
			$(this).addClass("active");
		});
		
		setDropdown();
    });
	
	window.setInterval(function(){setDropdown()},100000);
	
	function setDropdown(){
		$(".tpl-dropdown-list-bdbc").remove();
		$.post("${pageContext.request.contextPath}/admin/eventDropdown.do", function(data, status) {
			obj = $.parseJSON(data);
			var num=0;
			$(".tpl-dropdown-list-bdbc").remove();
			$.each(obj,function(index,item) {
				$(".tpl-dropdown-content-external").after("<li class='tpl-dropdown-list-bdbc'><a id='a"+index+"' href='javascript:void(0);' class='tpl-dropdown-list-fl'>"
						+item.content
						+"</a> <span class='tpl-dropdown-list-fr'>"
						+item.children.name
						+"</span></li>");
					num=index+1;
					$('.tpl-dropdown-content').on('click','#a'+index+'',function(e){
						$.post("${pageContext.request.contextPath}/admin/eventDropdown.do",{event_id:item.id},function(){
							alert(item.children.name+"事件已经开始侦查！")
							setDropdown();
						});
					});
			});
			$(".tpl-color-success").html(num);
			$(".tpl-badge-success").html(num);
		});
	}
	</script>
</body>
</html>